#ifndef GET_COM_MESSAGE_HPP
#define GET_COM_MESSAGE_HPP
#include "mavlink/common/mavlink.h"
#include <QDebug>
#include <QSerialPort>
#include <QSerialPortInfo>
#include <qlist.h>
#include <qtmetamacros.h>


class GetComMessage : public QObject {
  Q_OBJECT
public:
  explicit GetComMessage(QObject *parent = nullptr, QSerialPort *serial = nullptr);
  ~GetComMessage() = default;
  void parseMavlinkMessage();
  Q_INVOKABLE QList<int> putMavlinkMessage();
  mavlink_message_t getMavlinkMessage();
  
signals:
  // 添加GPS消息接收信号
  void gpsMessageReceived(const mavlink_message_t& msg);

private:
  QSerialPort *serial;
  mavlink_status_t mavlink_status;
  mavlink_message_t mavlink_msg;
  uint8_t mavlink_chan;
};

#endif
